<template>
  <tr>
    <td>
      <input type="checkbox" v-model="checked" @click='check'/>
    </td>
    <td>{{name}}</td>
    <td>{{price}}</td>
    <td>
      <button @click='minus'>-</button>
      {{num}}
      <button @click='add'>+</button>
      </td>
    <td>{{price * num}}</td>
    <td>
      <button @click='del'>删除</button>
    </td>
  </tr>
</template>

<script>
export default {
  props:['name','price','num','checked','index'],
  methods: {
    minus() {
      this.$emit('jisuan', -1, this.index)
    },
    add() {
      this.$emit('jisuan', 1, this.index)
    },
    check() {
      console.log(this.achecked);
      this.$emit('jisuan', 2, this.index)
    },
    del() {
      this.$emit('jisuan', 3, this.index)
    }
  },
  
}
</script>

<style>

</style>